<template>
    <input type="text" @keydown.enter="addTodo" placeholder="请输入待办事项，按回车键收集">
</template>

<script setup>
import { defineEmits } from 'vue';
const emit = defineEmits(['addTodo']);
const addTodo = (e) => {
    emit('addTodo', e.target.value)
    e.target.value = ''
}

</script>

<style scoped>
input {
    width: 100%;
    height: 40px;
    margin: 10px 0;
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
}
</style>